﻿using Microsoft.Extensions.Configuration;
using MiniFox.Configurations;

namespace MiniFox.Platform.OAuth2.Configurations
{
    /// <summary>
    /// 
    /// </summary>
    [Section(ELEMENT_NAME)]
    public class AuthorizationConfiguration
    {
        internal const string ELEMENT_NAME = "minifox:oauth2:authorization";

        const string INIT_URI = "/passport/init";
        const string SIGN_IN_URI = "/passport/signin";
        const int CODE_EXPIRES = 600;
        const int TICKET_EXPIRES = 3600;

        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName("initUri")]
        public string InitUri
        {
            get;
            set;
        } = INIT_URI;
        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName("signInUri")]
        public string SignInUri
        {
            get;
            set;
        } = SIGN_IN_URI;
        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName("defaultUri")]
        public string DefaultUri
        {
            get;
            set;
        }
        /// <summary>
        /// 授权码过期时长(秒),默认值300
        /// </summary>
        [ConfigurationKeyName("codeExpires")]
        public int CodeExpires
        {
            get;
            set;
        } = CODE_EXPIRES;
        /// <summary>
        /// 临时认证票据过期时长(秒),默认值3600秒(1小时)
        /// </summary>
        [ConfigurationKeyName("ticketExpires")]
        public int TicketExpires
        {
            get;
            set;
        } = TICKET_EXPIRES;
        /// <summary>
        /// 获取例外地址集，注：每一项配置需要从 http 协议段开始配置
        /// </summary>
        [ConfigurationKeyName("exceptionDomains")]
        public string[] ExceptionDomains
        {
            get;
            set;
        } = new string[0];

    }
}
